package lq;

import java.util.Scanner;

public class lq2014 {
    public static void main(String[] args){
        int max,min;
        double sum ,average;
        Scanner in = new Scanner(System.in);
        while (in.hasNext()){
            sum=0;
            average=0;
            max=0;
            min=100;
            int m=in.nextInt();
            int [] a = new int[m];
            for (int i=0;i<a.length;i++){
                a[i]=in.nextInt();
                if (a[i]>max){
                    max=a[i];
                }
                if (a[i]<min){
                    min=a[i];
                }
                sum+=a[i];
            }
            average=(sum-max-min)/(m-2);
            System.out.printf("%.2f",average);
            System.out.println();
        }
    }
}
